#include<bits/stdc++.h>
using namespace std;
#define int long long

string bs_up = "AQNU";
string bs_low = "aqnu";

signed main() {
	int T;
	cin >> T;
	for (int t = 1; t <= T; t++) {
		string s;
		cin >> s;

		int cnt_up, cnt_low;
		cnt_up = cnt_low = 0;

		for (auto i : s) {
			if (isupper(i) && bs_up.find(i) == string::npos)
				cnt_up++;
			else if (islower(i) && bs_low.find(i) == string::npos)
				cnt_low++;
		}

		if (cnt_up)
			cout << "第" << t << "组的大写特定字母有" << cnt_up << "个\n";
		else if (cnt_low)
			cout << "第" << t << "组的小写特定字母有" << cnt_low << "个\n";
		else
			cout << "第" << t << "组没有特定字母\n";
	}
	return 0;
}
